﻿<Window x:Class="LuminaDesk.Core.Views.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
		xmlns:sys="clr-namespace:System;assembly=mscorlib"
		xmlns:models="clr-namespace:LuminaDesk.Core.Models"
		xmlns:behaviors="clr-namespace:LuminaDesk.Core.Views.Behaviors"
		xmlns:controls="clr-namespace:LuminaDesk.Core.Views.Controls"
		xmlns:properties="clr-namespace:LuminaDesk.Core.Properties"
		Width="340" Height="200"
		ResizeMode="NoResize" SizeToContent="WidthAndHeight"
		ShowInTaskbar="False"
		AllowsTransparency="True" WindowStyle="None"
		Background="{DynamicResource App.Background.Plain}">
	<Window.Resources>
		<sys:Double x:Key="SliderHeight">52</sys:Double>
		<sys:Double x:Key="ThumbHeight">40</sys:Double>
		<sys:Double x:Key="BracketHeight">8</sys:Double>

		<Style x:Key="ToolTipStyle" TargetType="{x:Type ToolTip}">
			<Setter Property="OverridesDefaultStyle" Value="True"/>
			<Setter Property="Padding" Value="5,3"/>
			<Setter Property="Background" Value="{DynamicResource App.Background.Plain}"/>
			<Setter Property="Foreground" Value="{StaticResource App.Foreground}"/>
			<Setter Property="FontSize" Value="13"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ToolTip}">
						<Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
								BorderThickness="0"
								Background="{TemplateBinding Background}">
							<ContentPresenter Margin="{TemplateBinding Padding}"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource ToolTipStyle}"/>

		<!-- Slider -->
		<Color x:Key="Slider.Background.Range.StaticColor">#FFFFA500</Color>
		<Color x:Key="Slider.Background.Range.MouseOverColor">#FFFFC400</Color>
		<Color x:Key="Slider.Background.Range.PressedColor">#FFFFC400</Color>
		<Color x:Key="Slider.Background.Contrast.StaticColor">MediumOrchid</Color>
		<Color x:Key="Slider.Background.Contrast.MouseOverColor">Orchid</Color>
		<Color x:Key="Slider.Background.Contrast.PressedColor">Orchid</Color>
		<Color x:Key="Slider.Background.DisabledColor">#FFF0F0F0</Color>
		<Color x:Key="Slider.Background.VacantColor">#FF999999</Color>

		<SolidColorBrush x:Key="Slider.Background.Main.Static" Color="{DynamicResource App.Background.Accent.StaticColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Main.MouseOver" Color="{DynamicResource App.Background.Accent.MouseOverColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Main.Pressed" Color="{DynamicResource App.Background.Accent.PressedColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Range.Static" Color="{StaticResource Slider.Background.Range.StaticColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Range.MouseOver" Color="{StaticResource Slider.Background.Range.MouseOverColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Range.Pressed" Color="{StaticResource Slider.Background.Range.PressedColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Contrast.Static" Color="{StaticResource Slider.Background.Contrast.StaticColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Contrast.MouseOver" Color="{StaticResource Slider.Background.Contrast.MouseOverColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Contrast.Pressed" Color="{StaticResource Slider.Background.Contrast.PressedColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Disabled" Color="{StaticResource Slider.Background.DisabledColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Vacant" Color="{StaticResource Slider.Background.VacantColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Bracket" Color="{DynamicResource App.TargetColor}"/>
		<SolidColorBrush x:Key="Slider.Background.Overlay" Color="{DynamicResource App.OverlayColor}"/>

		<Style x:Key="MainSliderHorizontal" TargetType="{x:Type controls:CompoundSlider}">
			<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
			<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type controls:CompoundSlider}">
						<ControlTemplate.Resources>
							<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource ToolTipStyle}"/>

							<Style x:Key="SliderButtonHorizontal" TargetType="{x:Type RepeatButton}">
								<Setter Property="OverridesDefaultStyle" Value="True"/>
								<Setter Property="Focusable" Value="False"/>
								<Setter Property="IsTabStop" Value="False"/>
							</Style>

							<Style x:Key="SliderThumbHorizontal" TargetType="{x:Type Thumb}">
								<Setter Property="OverridesDefaultStyle" Value="True"/>
								<Setter Property="Focusable" Value="False"/>
								<Setter Property="Background" Value="Transparent"/>
								<Setter Property="Foreground" Value="{StaticResource Slider.Background.Main.Static}"/>
								<Style.Triggers>
									<Trigger Property="IsMouseOver" Value="True">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Main.MouseOver}"/>
									</Trigger>
									<Trigger Property="IsDragging" Value="True">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Main.Pressed}"/>
									</Trigger>
									<Trigger Property="IsEnabled" Value="False">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Disabled}"/>
									</Trigger>
								</Style.Triggers>
							</Style>

							<ControlTemplate x:Key="SliderThumbHorizontalLarge" TargetType="{x:Type Thumb}">
								<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
									<Rectangle Height="{DynamicResource BracketHeight}"
											   VerticalAlignment="Top"
											   Fill="{TemplateBinding Background}"/>
									<Rectangle Height="{DynamicResource BracketHeight}"
											   VerticalAlignment="Bottom"
											   Fill="{TemplateBinding Background}"/>

									<Rectangle Width="11" Height="{DynamicResource ThumbHeight}"
											   Margin="2"
											   Fill="{TemplateBinding Foreground}"/>
								</Grid>
							</ControlTemplate>

							<ControlTemplate x:Key="SliderThumbHorizontalSmall" TargetType="{x:Type Thumb}">
								<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
									<Path Width="22" Height="22"
										  Fill="{TemplateBinding Background}">
										<Path.Data>
											<CombinedGeometry GeometryCombineMode="Exclude">
												<CombinedGeometry.Geometry1>
													<EllipseGeometry Center="11,11" RadiusX="11" RadiusY="11"/>
												</CombinedGeometry.Geometry1>
												<CombinedGeometry.Geometry2>
													<PathGeometry Figures="M 0,0 L 22,22 22,0 0,22 Z"/>
												</CombinedGeometry.Geometry2>
											</CombinedGeometry>
										</Path.Data>
									</Path>

									<Ellipse Width="20" Height="20"
											 StrokeThickness="2.5"
											 Stroke="Transparent"
											 Fill="{TemplateBinding Foreground}"/>
								</Grid>
							</ControlTemplate>

							<ControlTemplate x:Key="ShadowThumbLarge" TargetType="{x:Type ContentControl}">
								<Rectangle Width="8"
										   controls:FrameworkElementMargin.Vertical="{DynamicResource BracketHeight}"
										   Fill="{TemplateBinding Foreground}"/>
							</ControlTemplate>

							<ControlTemplate x:Key="ShadowThumbSmall" TargetType="{x:Type ContentControl}">
								<Ellipse Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"
										 controls:FrameworkElementMargin.Vertical="{DynamicResource BracketHeight}"
										 Fill="{TemplateBinding Foreground}"/>
							</ControlTemplate>
						</ControlTemplate.Resources>

						<Border x:Name="border"
								Background="{TemplateBinding Background}"
								SnapsToDevicePixels="True" UseLayoutRounding="True">
							<Grid>
								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition x:Name="PART_ShadowLeft" Width="*"/>
										<ColumnDefinition Width="Auto"/>
										<ColumnDefinition x:Name="PART_ShadowRight" Width="*"/>
									</Grid.ColumnDefinitions>

									<ContentControl Grid.Column="1"
													x:Name="PART_ShadowThumb"
													Template="{StaticResource ShadowThumbLarge}"
													Foreground="{StaticResource Slider.Background.Vacant}"
													IsHitTestVisible="False"/>
								</Grid>

								<Rectangle Height="3" Margin="7.5,0" VerticalAlignment="Center"
										   Fill="{StaticResource Slider.Background.Vacant}"/>
								<Rectangle Width="{Binding ElementName=TrackLeft, Path=ActualWidth}"
										   Height="3" Margin="7.5,0" HorizontalAlignment="Left" VerticalAlignment="Center"
										   Fill="{StaticResource Slider.Background.Main.Static}"/>

								<Canvas VerticalAlignment="Center"
										IsHitTestVisible="False">
									<Rectangle x:Name="PART_SelectionRange"
											   Height="3"
											   Visibility="Hidden"/>
								</Canvas>

								<Grid Height="3" Margin="7.5,0"
									  ClipToBounds="True"
									  IsHitTestVisible="False"
									  Visibility="{Binding ElementName=PART_SelectionRange, Path=Visibility}">
									<Grid Margin="-7.5,0">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="{Binding ElementName=PART_SelectionRange, Path=(Canvas.Left)}"/>
											<ColumnDefinition Width="{Binding ElementName=PART_SelectionRange, Path=ActualWidth}"/>
											<ColumnDefinition Width="*"/>
										</Grid.ColumnDefinitions>

										<Rectangle Grid.Column="0"
												   Fill="{StaticResource Slider.Background.Overlay}"/>
										<Rectangle Grid.Column="2"
												   Fill="{StaticResource Slider.Background.Overlay}"/>
									</Grid>
								</Grid>

								<Track x:Name="PART_Track">
									<Track.DecreaseRepeatButton>
										<RepeatButton x:Name="TrackLeft"
													  Style="{StaticResource SliderButtonHorizontal}"
													  Command="{x:Static Slider.DecreaseLarge}"/>
									</Track.DecreaseRepeatButton>
									<Track.IncreaseRepeatButton>
										<RepeatButton x:Name="TrackRight"
													  Style="{StaticResource SliderButtonHorizontal}"
													  Command="{x:Static Slider.IncreaseLarge}"/>
									</Track.IncreaseRepeatButton>
									<Track.Thumb>
										<Thumb x:Name="thumb"
											   Style="{StaticResource SliderThumbHorizontal}"
											   Template="{StaticResource SliderThumbHorizontalLarge}"/>
									</Track.Thumb>
								</Track>
							</Grid>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelectionRangeEnabled" Value="True">
								<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
							</Trigger>
							<Trigger Property="IsUnison" Value="True">
								<Setter Property="Background" TargetName="thumb" Value="{StaticResource Slider.Background.Bracket}"/>
							</Trigger>
							<DataTrigger Binding="{Binding Settings.UsesLargeElements}" Value="False">
								<Setter TargetName="thumb" Property="Template" Value="{StaticResource SliderThumbHorizontalSmall}"/>
								<Setter TargetName="PART_ShadowThumb" Property="Template" Value="{StaticResource ShadowThumbSmall}"/>
							</DataTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>

			<Style.Triggers>
				<Trigger Property="IsSelectionRangeChanging" Value="True">
					<Setter Property="Template">
						<Setter.Value>
							<ControlTemplate TargetType="{x:Type controls:CompoundSlider}">
								<ControlTemplate.Resources>
									<Style x:Key="SliderThumbHorizontal" TargetType="{x:Type Thumb}">
										<Setter Property="OverridesDefaultStyle" Value="True"/>
										<Setter Property="Focusable" Value="False"/>
										<Setter Property="Background" Value="Transparent"/>
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Range.Static}"/>
										<Style.Triggers>
											<Trigger Property="IsMouseOver" Value="True">
												<Setter Property="Foreground" Value="{StaticResource Slider.Background.Range.MouseOver}"/>
											</Trigger>
											<Trigger Property="IsDragging" Value="True">
												<Setter Property="Foreground" Value="{StaticResource Slider.Background.Range.Pressed}"/>
											</Trigger>
											<Trigger Property="IsEnabled" Value="False">
												<Setter Property="Foreground" Value="{StaticResource Slider.Background.Disabled}"/>
											</Trigger>
										</Style.Triggers>
									</Style>

									<ControlTemplate x:Key="SliderThumbHorizontalLarge" TargetType="{x:Type Thumb}">
										<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
											<Rectangle Width="9" Height="{DynamicResource ThumbHeight}"
													   Margin="2"
													   Fill="{TemplateBinding Foreground}"/>
										</Grid>
									</ControlTemplate>

									<ControlTemplate x:Key="SliderThumbHorizontalSmall" TargetType="{x:Type Thumb}">
										<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
											<Ellipse Width="18" Height="18"
													 StrokeThickness="2.5"
													 Stroke="Transparent"
													 Fill="{TemplateBinding Foreground}"/>
										</Grid>
									</ControlTemplate>
								</ControlTemplate.Resources>

								<Border x:Name="border"
										Background="{TemplateBinding Background}"
										SnapsToDevicePixels="True" UseLayoutRounding="True">
									<Grid>
										<Rectangle Height="3" Margin="7.5,0" VerticalAlignment="Center"
												   Fill="{StaticResource Slider.Background.Vacant}"/>

										<Canvas Height="3" VerticalAlignment="center">
											<Rectangle x:Name="PART_SelectionRange"
													   Height="3"
													   Fill="{StaticResource Slider.Background.Range.Static}"
													   Visibility="Visible"/>
										</Canvas>

										<!-- This is necessary for PART_SelectionRange to work. -->
										<Track x:Name="PART_Track"
											   Visibility="Hidden"
											   IsHitTestVisible="False">
											<Track.Thumb>
												<Thumb Style="{x:Null}"/>
											</Track.Thumb>
										</Track>

										<Track x:Name="PART_StartTrack">
											<Track.Thumb>
												<Thumb x:Name="startThumb"
													   Style="{StaticResource SliderThumbHorizontal}"
													   Template="{StaticResource SliderThumbHorizontalLarge}"/>
											</Track.Thumb>
										</Track>
										<Track x:Name="PART_EndTrack">
											<Track.Thumb>
												<Thumb x:Name="endThumb"
													   Style="{StaticResource SliderThumbHorizontal}"
													   Template="{StaticResource SliderThumbHorizontalLarge}"/>
											</Track.Thumb>
										</Track>
									</Grid>
								</Border>

								<ControlTemplate.Triggers>
									<DataTrigger Binding="{Binding Settings.UsesLargeElements}" Value="False">
										<Setter TargetName="startThumb" Property="Template" Value="{StaticResource SliderThumbHorizontalSmall}"/>
										<Setter TargetName="endThumb" Property="Template" Value="{StaticResource SliderThumbHorizontalSmall}"/>
									</DataTrigger>
								</ControlTemplate.Triggers>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Trigger>
			</Style.Triggers>
		</Style>

		<Style x:Key="SubSliderHorizontal" TargetType="{x:Type controls:EnhancedSlider}">
			<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
			<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type controls:EnhancedSlider}">
						<ControlTemplate.Resources>
							<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource ToolTipStyle}"/>

							<Style x:Key="SliderButtonHorizontal" TargetType="{x:Type RepeatButton}">
								<Setter Property="OverridesDefaultStyle" Value="True"/>
								<Setter Property="Focusable" Value="False"/>
								<Setter Property="IsTabStop" Value="False"/>
							</Style>

							<Style x:Key="SliderThumbHorizontal" TargetType="{x:Type Thumb}">
								<Setter Property="OverridesDefaultStyle" Value="True"/>
								<Setter Property="Focusable" Value="False"/>
								<Setter Property="Background" Value="Transparent"/>
								<Setter Property="Foreground" Value="{StaticResource Slider.Background.Contrast.Static}"/>
								<Style.Triggers>
									<Trigger Property="IsMouseOver" Value="True">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Contrast.MouseOver}"/>
									</Trigger>
									<Trigger Property="IsDragging" Value="True">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Contrast.Pressed}"/>
									</Trigger>
									<Trigger Property="IsEnabled" Value="False">
										<Setter Property="Foreground" Value="{StaticResource Slider.Background.Disabled}"/>
									</Trigger>
								</Style.Triggers>
							</Style>

							<ControlTemplate x:Key="SliderThumbHorizontalLarge" TargetType="{x:Type Thumb}">
								<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
									<Rectangle Width="11" Height="{DynamicResource ThumbHeight}"
											   Margin="2"
											   Fill="{TemplateBinding Foreground}"/>
								</Grid>
							</ControlTemplate>

							<ControlTemplate x:Key="SliderThumbHorizontalSmall" TargetType="{x:Type Thumb}">
								<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
									<Ellipse Width="20" Height="20"
											 StrokeThickness="2.5"
											 Stroke="Transparent"
											 Fill="{TemplateBinding Foreground}"/>
								</Grid>
							</ControlTemplate>
						</ControlTemplate.Resources>

						<Border x:Name="border"
								Background="{TemplateBinding Background}"
								SnapsToDevicePixels="True" UseLayoutRounding="True">
							<Grid>
								<Rectangle Height="3" Margin="7.5,0" VerticalAlignment="Center"
										   Fill="{StaticResource Slider.Background.Vacant}"/>
								<Rectangle Width="{Binding ElementName=TrackLeft, Path=ActualWidth}"
										   Height="3" Margin="7.5,0" HorizontalAlignment="Left" VerticalAlignment="Center"
										   Fill="{StaticResource Slider.Background.Contrast.Static}"/>

								<Track x:Name="PART_Track">
									<Track.DecreaseRepeatButton>
										<RepeatButton x:Name="TrackLeft"
													  Style="{StaticResource SliderButtonHorizontal}"
													  Command="{x:Static Slider.DecreaseLarge}"/>
									</Track.DecreaseRepeatButton>
									<Track.IncreaseRepeatButton>
										<RepeatButton x:Name="TrackRight"
													  Style="{StaticResource SliderButtonHorizontal}"
													  Command="{x:Static Slider.IncreaseLarge}"/>
									</Track.IncreaseRepeatButton>
									<Track.Thumb>
										<Thumb x:Name="thumb"
											   Style="{StaticResource SliderThumbHorizontal}"
											   Template="{StaticResource SliderThumbHorizontalLarge}"/>
									</Track.Thumb>
								</Track>
							</Grid>
						</Border>

						<ControlTemplate.Triggers>
							<DataTrigger Binding="{Binding Settings.UsesLargeElements}" Value="False">
								<Setter TargetName="thumb" Property="Template" Value="{StaticResource SliderThumbHorizontalSmall}"/>
							</DataTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<!-- Pulse Label -->
		<Style x:Key="PulseLabelStyle" TargetType="{x:Type controls:PulseLabel}">
			<Setter Property="FontSize" Value="12"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type controls:PulseLabel}">
						<Grid>
							<Border>
								<TextBlock HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
										   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
										   Text="{TemplateBinding ContentPresenter.Content}">
									<TextBlock.Foreground>
										<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
											<GradientStop x:Name="head" Color="{DynamicResource App.ForegroundColor}" Offset="0.0"/>
											<GradientStop x:Name="middle" Color="{DynamicResource App.ForegroundColor}" Offset="0.0"/>
											<GradientStop x:Name="tail" Color="{DynamicResource App.ForegroundColor}" Offset="0.0"/>
										</LinearGradientBrush>
									</TextBlock.Foreground>
								</TextBlock>
							</Border>

							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup Name="PulseStates">
									<VisualState x:Name="Off"/>
									<VisualState x:Name="On">
										<Storyboard>
											<ColorAnimation Storyboard.TargetName="middle"
															Storyboard.TargetProperty="(GradientStop.Color)"
															Duration="0"
															To="{DynamicResource App.ShadowColor}"/>
											<DoubleAnimation Storyboard.TargetName="head"
															 Storyboard.TargetProperty="(GradientStop.Offset)"
															 Duration="0:0:1.2"
															 From="0.0" To="1.8"
															 RepeatBehavior="Forever"/>
											<DoubleAnimation Storyboard.TargetName="middle"
															 Storyboard.TargetProperty="(GradientStop.Offset)"
															 Duration="0:0:1.2"
															 From="-0.4" To="1.4"
															 RepeatBehavior="Forever"/>
											<DoubleAnimation Storyboard.TargetName="tail"
															 Storyboard.TargetProperty="(GradientStop.Offset)"
															 Duration="0:0:1.2"
															 From="-0.8" To="1.0"
															 RepeatBehavior="Forever"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<!-- Icon Button -->
		<Style x:Key="IconButtonStyle" TargetType="{x:Type controls:IconButton}">
			<Setter Property="Focusable" Value="False"/>
			<Setter Property="Width" Value="28"/>
			<Setter Property="Height" Value="30"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="IsLastVisibleButton" Value="False"/>
			<Setter Property="Foreground" Value="{StaticResource Icon.Foreground.Normal}"/>
			<Setter Property="SnapsToDevicePixels" Value="True"/>
			<Setter Property="UseLayoutRounding" Value="True"/>
			<Setter Property="ToolTipService.InitialShowDelay" Value="1000"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type controls:IconButton}">
						<Grid>
							<Border x:Name="border"
									Background="Transparent">
								<Grid Margin="{TemplateBinding Padding}">
									<Grid Height="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}"
										  Margin="7,6" VerticalAlignment="Center"
										  RenderOptions.EdgeMode="Aliased">
										<Path x:Name="StrokeIcon"
											  Data="{TemplateBinding StrokeIconData}" Stretch="Uniform"
											  Stroke="{TemplateBinding Foreground}" StrokeThickness="1"/>
										<Path x:Name="FillIcon"
											  Data="{TemplateBinding FillIconData}" Stretch="Uniform"
											  Fill="{TemplateBinding Foreground}"/>
									</Grid>
								</Grid>
							</Border>

							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver">
										<Storyboard>
											<ColorAnimation Storyboard.TargetName="border"
															Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
															Duration="0:0:0.1"
															To="{DynamicResource Icon.Background.MouseOverColor}"/>
											<ColorAnimation Storyboard.TargetName="StrokeIcon"
															Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
															Duration="0:0:0.1"
															To="{DynamicResource App.ForegroundColor}"/>
											<ColorAnimation Storyboard.TargetName="FillIcon"
															Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
															Duration="0:0:0.1"
															To="{DynamicResource App.ForegroundColor}"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Pressed">
										<Storyboard>
											<ColorAnimation Storyboard.TargetName="border"
															Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
															Duration="0"
															To="{DynamicResource Icon.Background.PressedColor}"/>
											<ColorAnimation Storyboard.TargetName="StrokeIcon"
															Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"
															Duration="0"
															To="{DynamicResource App.ForegroundColor}"/>
											<ColorAnimation Storyboard.TargetName="FillIcon"
															Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
															Duration="0"
															To="{DynamicResource App.ForegroundColor}"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimation Storyboard.TargetName="border"
															 Storyboard.TargetProperty="Opacity"
															 Duration="0"
															 To="0"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsLastVisibleButton" Value="True">
					<Setter Property="Width" Value="31"/>
					<Setter Property="Padding" Value="0,0,3,0"/>
				</Trigger>
			</Style.Triggers>
		</Style>

		<Style x:Key="UnisonButtonStyle" TargetType="{x:Type controls:IconButton}" BasedOn="{StaticResource IconButtonStyle}">
			<Setter Property="StrokeIconData" Value="M 0,3 L 0,0 10,0 10,3 M 0,7 L 0,10 10,10 10,7"/>
		</Style>

		<Style x:Key="RangeButtonStyle" TargetType="{x:Type controls:IconButton}" BasedOn="{StaticResource IconButtonStyle}">
			<Setter Property="StrokeIconData" Value="M 0,2 L 0,8 M 0,5 L 10,5 M 10,2 L 10,8"/>
		</Style>

		<Style x:Key="ContrastButtonStyle" TargetType="{x:Type controls:IconButton}" BasedOn="{StaticResource IconButtonStyle}">
			<Setter Property="StrokeIconData" Value="M 0,0 L 0,10 10,10 10,0 Z"/>
			<Setter Property="FillIconData" Value="M 0,0 L 0,10 5,10 5,0 Z M 10,0 L 10,10"/>
		</Style>

		<!-- Number Label -->
		<Style x:Key="NumberLabelStyle" TargetType="{x:Type Label}">
			<Setter Property="VerticalAlignment" Value="Center"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Right"/>
			<Setter Property="Foreground" Value="{StaticResource App.Foreground}"/>
			<Setter Property="FontFamily" Value="Segoe UI"/>
		</Style>
	</Window.Resources>

	<Grid Width="340">
		<!-- Pulse -->
		<controls:PulseLabel Margin="8,4"
							 Style="{StaticResource PulseLabelStyle}"
							 Content="{Binding Source={x:Static models:ProductInfo.Title}, Mode=OneTime}"
							 IsPulsing="{Binding IsScanning, Mode=OneWay}"
							 Visibility="{Binding IsMonitorsEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}"/>

		<!-- Monitors-->
		<ListView ItemsSource="{Binding MonitorsView}"
				  SelectionMode="Single">
			<ListView.Template>
				<ControlTemplate TargetType="{x:Type ListView}">
					<Border BorderThickness="0">
						<ScrollViewer CanContentScroll="False"
									  HorizontalScrollBarVisibility="Disabled"
									  VerticalScrollBarVisibility="Auto">
							<VirtualizingStackPanel IsItemsHost="True"/>
						</ScrollViewer>
					</Border>
				</ControlTemplate>
			</ListView.Template>
			<ListView.ItemTemplate>
				<DataTemplate>
					<Grid Margin="0,0,0,8"
						  Background="Transparent">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>

						<Grid Grid.Row="0">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="Auto"/>
							</Grid.ColumnDefinitions>

							<!-- Name -->
							<controls:SwitchTextBox Grid.Column="0"
													Height="22" Margin="8,5,0,5" HorizontalAlignment="Left" VerticalAlignment="Center"
													Style="{StaticResource NameTextBoxStyle}"
													TextWrapping="Wrap" MaxLength="96"
													Text="{Binding Name, Mode=TwoWay}"/>

							<StackPanel Grid.Column="1"
										VerticalAlignment="Top"
										Orientation="Horizontal">
								<!-- Unison -->
								<controls:IconButton Style="{StaticResource UnisonButtonStyle}"
													 ToolTip="{x:Static properties:Resources.ChangeUnison}"
													 Visibility="{Binding Settings.EnablesUnison, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}"
													 IsChecked="{Binding IsUnison, Mode=TwoWay}"/>

								<!-- Range -->
								<controls:IconButton Style="{StaticResource RangeButtonStyle}"
													 ToolTip="{x:Static properties:Resources.ChangeRange}"
													 Visibility="{Binding Settings.EnablesRange, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}"
													 IsChecked="{Binding IsRangeChanging, Mode=TwoWay}"/>

								<!-- Contrast -->
								<controls:IconButton Style="{StaticResource ContrastButtonStyle}"
													 ToolTip="{x:Static properties:Resources.ChangeContrast}"
													 IsEnabled="{Binding IsContrastSupported, Mode=OneWay}"
													 Visibility="{Binding Settings.EnablesContrast, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}"
													 IsChecked="{Binding IsContrastChanging, Mode=TwoWay}"/>
							</StackPanel>
						</Grid>

						<Grid Grid.Row="1"
							  Height="{DynamicResource SliderHeight}"
							  Margin="0,0,12,0"
							  Visibility="{Binding IsControllable, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="4"/>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
							</Grid.ColumnDefinitions>

							<Rectangle Grid.Column="0"
									   Fill="{StaticResource Slider.Background.Main.Static}"
									   Visibility="{Binding IsSelectedByKey, Converter={StaticResource BooleanToVisibilityConverterKey}}"/>

							<!-- Brightness -->
							<controls:CompoundSlider Grid.Column="1"
													 Margin="12,0,4,0" VerticalAlignment="Center"
													 Style="{StaticResource MainSliderHorizontal}"
													 Minimum="0" Maximum="100"
													 SmallChange="1"
													 Value="{Binding Brightness, Mode=TwoWay, Delay=50}"
													 DefersUpdateSource="{Binding Settings.DefersChange, Mode=OneWay}"
													 IsShadowVisible="{Binding Settings.ShowsAdjusted, Mode=OneWay}"
													 ValueShadow="{Binding BrightnessSystemAdjusted, Mode=OneWay}"
													 IsUnison="{Binding IsUnison, Mode=TwoWay}"
													 ValueUnison="{Binding BrightnessSystemChanged, Mode=OneWay}"
													 MinimumSelectionRange="10"
													 IsSelectionRangeChanging="{Binding IsRangeChanging, Mode=OneWay}"
													 SelectionStart="{Binding RangeLowest, Mode=TwoWay, Delay=50}"
													 SelectionEnd="{Binding RangeHighest, Mode=TwoWay, Delay=50}">
								<i:Interaction.Behaviors>
									<behaviors:ItemSliderBehavior IsSelected="{Binding IsSelected, Mode=OneWay}"
																  IsByKey="{Binding IsByKey, Mode=TwoWay}"
																  SecondObject="{Binding ElementName=ContrastSlider, Mode=OneTime}"/>
									<behaviors:MouseHorizontalWheelBehavior/>
								</i:Interaction.Behaviors>
							</controls:CompoundSlider>

							<Label Grid.Column="2"
								   Width="26" Margin="0,0,4,0"
								   Style="{StaticResource NumberLabelStyle}"
								   FontSize="16"
								   Content="{Binding Brightness, Mode=OneWay}"
								   Visibility="{Binding IsRangeChanging, Mode=OneWay, Converter={StaticResource BooleanToVisibilityTurnConverterKey}, ConverterParameter=True}">
								<i:Interaction.Triggers>
									<i:EventTrigger EventName="MouseDown">
										<i:CallMethodAction TargetObject="{Binding}" MethodName="IncrementBrightness"/>
									</i:EventTrigger>
								</i:Interaction.Triggers>
							</Label>

							<Label Grid.Column="3"
								   Width="48" Margin="0,0,4,0"
								   Style="{StaticResource NumberLabelStyle}"
								   FontSize="15"
								   Visibility="{Binding IsRangeChanging, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}">
								<TextBlock>
									<Run Text="{Binding RangeLowest, Mode=OneWay}"/><Run Text="-"/><Run Text="{Binding RangeHighest, Mode=OneWay}"/>
								</TextBlock>
							</Label>

							<!-- Contrast -->
							<controls:EnhancedSlider Grid.Column="4"
													 x:Name="ContrastSlider"
													 Width="100" Margin="8,0,4,0" VerticalAlignment="Center"
													 Style="{StaticResource SubSliderHorizontal}"
													 Minimum="0" Maximum="100"
													 SmallChange="1"
													 Value="{Binding Contrast, Mode=TwoWay, Delay=50}"
													 DefersUpdateSource="{Binding Settings.DefersChange, Mode=OneWay}"
													 Visibility="{Binding IsContrastChanging, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}">
								<i:Interaction.Behaviors>
									<behaviors:ItemSliderBehavior/>
									<behaviors:MouseHorizontalWheelBehavior/>
								</i:Interaction.Behaviors>
							</controls:EnhancedSlider>

							<Label Grid.Column="5"
								   Width="26" Margin="0,0,4,0"
								   Style="{StaticResource NumberLabelStyle}"
								   FontSize="16"
								   Content="{Binding Contrast, Mode=OneWay}"
								   Visibility="{Binding IsContrastChanging, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverterKey}}"/>
						</Grid>

						<!-- Message -->
						<Grid Grid.Row="2"
							  Visibility="{Binding NormalMessage, Mode=OneWay, Converter={StaticResource ObjectToVisibilityConverterKey}}">
							<TextBlock Style="{StaticResource PlainTextStyle}"
									   Margin="12,2,12,2"
									   TextWrapping="Wrap"
									   Text="{Binding NormalMessage, Mode=OneWay}"/>
						</Grid>
						<Grid Grid.Row="3"
							  Visibility="{Binding WarningMessage, Mode=OneWay, Converter={StaticResource ObjectToVisibilityConverterKey}}">
							<TextBlock Style="{StaticResource InvalidTextStyle}"
									   Margin="12,2,12,2"
									   TextWrapping="Wrap"
									   Text="{Binding WarningMessage, Mode=OneWay}"/>
						</Grid>
					</Grid>
				</DataTemplate>
			</ListView.ItemTemplate>
			<ListView.ItemContainerStyle>
				<Style TargetType="{x:Type ListViewItem}">
					<Setter Property="OverridesDefaultStyle" Value="True"/>
					<Setter Property="Margin" Value="0"/>
					<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
					<Setter Property="Template">
						<Setter.Value>
							<ControlTemplate TargetType="{x:Type ContentControl}">
								<ContentPresenter/>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Style>
			</ListView.ItemContainerStyle>

			<i:Interaction.Behaviors>
				<behaviors:ItemSelectorBehavior/>
			</i:Interaction.Behaviors>
		</ListView>
	</Grid>
</Window>